import { request } from '@/utils/request';

/**
 * 账号密码登录
 * @param data
 * @returns
 */
const login = async (data: { username: string; password: string }) => {
  return request.post({
    url: '/auth/login',
    data,
  });
};

/**
 * 退出登录
 * @returns
 */
const logout = async () => {
  return request.get({
    url: '/auth/logout',
  });
};

/**
 * 清除缓存
 * @returns
 */
const clearCache = async () => {
  return request.get({
    url: '/auth/clearCache',
  });
};

/**
 * 获取用户信息
 * @returns
 */
const getUserInfo = async () => {
  return request.get({
    url: '/auth/info',
  });
};

export { clearCache, getUserInfo, login, logout };
